﻿@model Rated.DAL.Db.Review
<div class="itemRating clearfix" style="display: none">
    <div class="itemRating_Rator">
        <img src="../../Content/ratedDjs.com/images/defaultItem.png" class="memberImage" />
        <span class="ratorName">@Model.UserProfile.FullName</span><span class="ratorLocation">@Model.UserProfile.Location</span>
    </div>
    <div class="itemRating_description">
        <h3>
            "@Model.Title"</h3>
        <div class="itemRating_Details">
            <div class="itemRating_Rating clearfix">
                <ul>
                    @{
                        for (int i = 1; i <= Model.Rating; i++)
                        { 
                        <li>★</li>    
                        }
                    }
                </ul>
                <span class="ratorTimestamp">Reviewed @Model.Timestamp.Value.ToShortDateString()</span>
            </div>
        </div>
        <div class="blocktext">
            @Model.Description
            @{
                if (!string.IsNullOrEmpty(Model.Response))
                {
                <div class="ratingResponse clearfix">
                    <h4>
                        Response <span class="ratorTimestamp">@Model.Timestamp.Value.ToShortDateString()</span></h4>
                    @Model.Response
                </div>
                }
            }
        </div>
        @{
            if (Model.CurrentUserOwnsRatedItem)
            {
                if (Model.Response == null)
                {
            <form method="post" id="respondToReview_@Model.ID" class="respondToReview" action="@Url.Action("Respond", "Review")">
            @Html.Hidden("itemID", Model.ID)
            <button class="btnRespond cta floatright">
                Respond to this comment</button>
            </form>
                }
            }
        }
        @{
            if (Model.CurrentUserOwnsReview(Model.ID))
            {
            <div class="reviewEditorform" style="display:none">
                <form method="post" id="editReview_@Model.ID" class="editReview" action="@Url.Action("Edit", "Review")">
                @Html.Hidden("itemID", Model.ID)
                <p>
               <label>Rating</label>
            @Html.TextBox("Rating", Model.Rating)
            </p>
            <p>
            <label>Title</label>
            @Html.TextBox("Title", Model.Title)
            </p>
            <p>
            <label>Description</label>
            @Html.TextArea("Description", Model.Description)
            </p>
                 <button id="btnUpdateReview" class="cta2 floatright">
            Update</button>

                </form>
                 <button class="cancel floatright btnCancelUpdateReview">
            Forget it</button>
            </div>
            <button class="btnEditReview cta floatright">
                Edit this review</button>
            }
            
            
        }
    </div>
</div>
